public class OrderInitializedState implements OrderState {

	public OrderInterface order;
	public ClosedOrder closeOrder;

	public OrderInitializedState(OrderInterface orderInterface) {
		this.order = orderInterface;
	}

	@Override
	public String initializeOrder() {
		order.setState(order.getOrderInitializedState());
		System.out.println("order -> Order Initialized! ");
		return "Order Initialized";
	}

	@Override
	public String activeOrder() {
		order.setState(order.getOrderActiveState());
		System.out.println("Initialized -> Order Activated! ");
		return "Order Activated! ";
	}

	@Override
	public String partialOrder() {
		return "Order Not Initialized";
	}

	@Override
	public String closeOrder(boolean isOrderFulfilled) {
		order.setState(order.getOrderClosedState());
		if (isOrderFulfilled) {
			System.out.println("Initialized -> Order CLosed (Fulfilled)! ");
			closeOrder = new OrderFulfilled();
		} else {
			System.out.println("Initialized -> Order CLosed (cancelled)! ");
			closeOrder = new OrderCancelled();
		}
		closeOrder.closeOrder();
		return "Order Closed";
	}

}
